package com.yanqu.road.dataHelper.manager;

import com.yanqu.road.dataHelper.utils.ExcelData;
import com.yanqu.road.utils.MyProperties;

import java.io.File;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class GameMgr extends BaseMgr {

    private static Map<String,Map<String,Map<String,String>>> excelData = new ConcurrentHashMap<>();

    private static MyProperties dbProps;

    public GameMgr(){

    }
    public static boolean init(String dirPath){
        if(!initConfig(dirPath)){
            return false;
        }
        if(!initExcel(dirPath)){
            return false;
        }
        return true;
    }
    private static boolean initConfig(String dirPath){
        String path = dirPath + "config" + File.separator;
        dbProps = new MyProperties(path + "game.properties");
//        System.out.println(dbProps.getProperty("db_user"));
//        System.out.println(dbProps.getProperty("user"));
//        System.out.println(dbProps.getProperty("pwd"));
        return true;
    }

    private static Boolean initExcel(String dirPath){
        /*ExcelData sheet0 = new ExcelData(dirPath + "inExcel" + File.separator + "pass.xlsx", "sheet0");
        excelData.put("pass",sheet0.getExcelData());*/
        return true;
    }

    public static String getProperty(String key){
        return dbProps.getProperty(key);
    }

    public static Map<String,Map<String,String>> getExcelData(String key){
        return excelData.get(key);
    }
}
